/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasMesTeam extends BasicModel<BasMesTeam> {
  code?: string; // 班组编码
  name?: string; // 班组名称
  officeId?: string; // 所属车间
  basMesTeamOperatorList?: any[]; // 子表列表
}

export const basMesTeamList = (params?: BasMesTeam | any) =>
  defHttp.get<BasMesTeam>({ url: adminPath + '/bas/mes/team/basMesTeam/list', params });

export const basMesTeamListData = (params?: BasMesTeam | any) =>
  defHttp.post<Page<BasMesTeam>>({ url: adminPath + '/bas/mes/team/basMesTeam/listData', params });

export const basMesTeamForm = (params?: BasMesTeam | any) =>
  defHttp.get<BasMesTeam>({ url: adminPath + '/bas/mes/team/basMesTeam/form', params });

export const basMesTeamSave = (params?: any, data?: BasMesTeam | any) =>
  defHttp.postJson<BasMesTeam>({ url: adminPath + '/bas/mes/team/basMesTeam/save', params, data });

export const basMesTeamImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/mes/team/basMesTeam/importData',
      onUploadProgress,
    },
    params,
  );

export const basMesTeamDelete = (params?: BasMesTeam | any) =>
  defHttp.get<BasMesTeam>({ url: adminPath + '/bas/mes/team/basMesTeam/delete', params });

export const basTeamListTreeData = (params?: BasMesTeam | any) =>
  defHttp.post<Page<BasMesTeam>>({ url: adminPath + '/bas/mes/team/basMesTeam/treeData', params });
